package com.jt.mapper;

import com.jt.pojo.User;
import com.jt.vo.PageResult;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from user")
    List<User> findAll();
@Select("select * from user where username=#{username} and password =#{password}")
    User findUserByUP(User user);

//    PageResult getUserList(PageResult pageResult);
@Select("select count(1) from user where username like "+"\"%\"#{query}\"%\"")
    long getTal(String query);
//@Select("select * from user where username like "+"\"%\"#{query}\"%\""+" limit #{start},#{size}")
    List<User> findUserListByPage(@Param("start") int start, @Param("size") int size,@Param("query") String query);
@Update("update user set status=#{status},updated = #{updated} where id = #{id}")
    void updateStatus(User user);
@Insert("insert into user value(null,#{username},#{password},#{phone},#{email},#{status},#{created},#{updated})")
    void addUser(User user);
@Select("select * from user where id =#{id}")
    User findUserById(Integer id);
@Update("update user set phone=#{phone},email=#{email} where id=#{id}")
    void updateUser(User user);
@Delete("delete from user where id=#{id}")
    void deleteUser(Integer id);
}
